/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DTO;

import BLL.BCategory1;
import BLL.BCategory3;
import java.util.ArrayList;

/**
 *
 * @author Vien-IT
 */
public class Category2 {
    private int category2Id;
    private String name;
    private int category1Id;
    private Category1 category1;
    private ArrayList<Category3> categories3;

    /**
     * @return the category2Id
     */
    public int getCategory2Id() {
        return category2Id;
    }

    /**
     * @param category2Id the category2Id to set
     */
    public void setCategory2Id(int category2Id) {
        this.category2Id = category2Id;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the category1Id
     */
    public int getCategory1Id() {
        
        return category1Id;
    }

    /**
     * @param category1Id the category1Id to set
     */
    public void setCategory1Id(int category1Id) {
        this.category1Id = category1Id;
    }

    /**
     * @return the category1
     */
    public Category1 getCategory1() {
        if(category1 == null)
        {
            category1 = new BCategory1().getById(category1Id);
        }
        return category1;
    }

    /**
     * @param category1 the category1 to set
     */
    public void setCategory1(Category1 category1) {
        this.category1 = category1;
    }

    /**
     * @return the categories3
     */
    public ArrayList<Category3> getCategories3() {
        if(categories3 == null)
        {
            categories3 = new BCategory3().getByCategory2Id(category2Id);
        }
        return categories3;
    }

    
    
    
    
}
